package com.ssf.hsdtouch.extension.fragment;

import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.ssf.hsdtouch.extension.R;
import com.ssf.hsdtouch.extension.entity.FileObj;

public class PicFragment extends Fragment {

	Activity			context;

	private ImageView	picView;

	private String		path;

	private FileObj		obj;

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		picView = (ImageView) inflater.inflate(R.layout.layout_pic, null);
		return picView;
	}

	@Override
	public void onCreate(Bundle savedInstanceState) {
		context = getActivity();
		obj = (FileObj) getArguments().getSerializable("file");
		path = obj.getFilePath();
		super.onCreate(savedInstanceState);
	}

	@Override
	public void onViewCreated(View view, Bundle savedInstanceState) {
		super.onViewCreated(view, savedInstanceState);
		picView.setImageURI(Uri.parse(path));
	}

	@Override
	public void onDestroy() {
		super.onDestroy();
		if (picView != null) {
			picView = null;
		}
	}
}
